from django import forms
from .models import ArticleModel


# TODO: 【Django文件上传】限制上传的文件拓展名
class ArticleForm(forms.ModelForm):
    class Meta:
        model = ArticleModel
        fields = '__all__'

        # TODO: 自定义错误消息
        error_messages = {
            'thumbnail': {
                'invalid_extension': '上传文件格式不符',
                'required': 'thumbnail不能为空',
                'invalid_image': '上传文件格式不符'
            }
        }
